package edu.hnu.productserver.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;

@TableName(value ="stocks")
@Data
public class Stocks implements Serializable {

    @TableId(value = "ticker", type = IdType.AUTO)
    private String ticker;

    @TableField(value = "RIC")
    private String RIC;

    @TableField(value = "issue_sector")
    private String issue_sector;

    @TableField(value = "stock_price")
    private BigDecimal stock_price;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Stocks other = (Stocks) that;
        return (this.getTicker() == null ? other.getTicker() == null : this.getTicker().equals(other.getTicker()))
            && (this.getRIC() == null ? other.getRIC() == null : this.getRIC().equals(other.getRIC()))
            && (this.getIssue_sector() == null ? other.getIssue_sector() == null : this.getIssue_sector().equals(other.getIssue_sector()))
            && (this.getStock_price() == null ? other.getStock_price() == null : this.getStock_price().equals(other.getStock_price()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getTicker() == null) ? 0 : getTicker().hashCode());
        result = prime * result + ((getRIC() == null) ? 0 : getRIC().hashCode());
        result = prime * result + ((getIssue_sector() == null) ? 0 : getIssue_sector().hashCode());
        result = prime * result + ((getStock_price() == null) ? 0 : getStock_price().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", ticker=").append(ticker);
        sb.append(", RIC=").append(RIC);
        sb.append(", issue_sector=").append(issue_sector);
        sb.append(", stock_price=").append(stock_price);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}